package com.xhdx.pattern.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * 
 * 具体迭代器
 *
 */
public class ConcreteIterator implements Iterator<String>{
    private List<String> list;
    private int index = 0;
    
    public ConcreteIterator(List<String> li){
        this.list = li;
    }
    @Override
    public boolean hasNext() {
        if(list != null && list.size()> index){
            return true;
        }
        return false;
    }

    @Override
    public String next() {
        String data = list.get(index);
        index++;
        
        return data;
    }

}
